package com.ss.android.article.base.feature.model;

import com.ss.android.b.a.BaseAdsData;
import com.ss.android.image.model.ImageInfo;

import org.json.JSONObject;

public final class AdsData extends BaseAdsData {
    public String merchantArea;
    public String shop;
    public String distance;
    public String value;
    public String price;
    public String sales;
    public String appointment;
    public String description;
    public String _openUrl;
    public ImageInfo image;
    public String adLabel;
    public String source;
    public int m;

    public AdsData() {

        this.m = 1;
    }

    public final boolean isValid() {
        return (!android.support.design.a.isTextEmpty(this.shop))
                && (!android.support.design.a.isTextEmpty(this.description))
                && (!android.support.design.a.isTextEmpty(this.value))
                && (!android.support.design.a.isTextEmpty(this.price))
                && this.image != null && this.image.isValid();
    }

    public final void initWithJO(JSONObject jo) {
        super.initWithJO(jo);
        this.distance = jo.optString("distance");
        this.value = jo.optString("value");
        this.price = jo.optString("price");
        this.sales = jo.optString("sales");
        this.shop = jo.optString("shop");
        this.merchantArea = jo.optString("merchant_area");
        this.appointment = jo.optString("appointment");
        this._openUrl = jo.optString("open_url");
        this.description = jo.optString("description");
        this.source = jo.optString("source");
        this.adLabel = jo.optString("ad_label");
        this.image = ImageInfo.fromJson(jo.optJSONObject("image"), false);
    }
}

